<?php
defined("_VALID_ACCESS") || die('Direct access forbidden');
    class Eyeworx_PatientRecords_Patient_RBO_RBOPatient extends RBO_Recordset {

        public function display_patient_full_name($record, $nolink=false) {
            $name = $record['patient_full_name'] = $record['first_name'] . " " . $record['middle_name'] . " " . $record['last_name'];
            return $name;
        }

        public function fields() {
            $fields = array();

            $first = new RBO_Field_Text('First Name');
            $first->set_length(128)->set_required();
            $fields[] = $first;

            $middle = new RBO_Field_Text('Middle Name');
            $middle->set_length(128)->set_required();
            $fields[] = $middle;

            $last = new RBO_Field_Text('Last Name');
            $last->set_length(128)->set_required();
            $fields[] = $last;

            $name = new RBO_Field_Calculated('Patient Full Name');
            $name->set_db_type('text', 128);
            $name->set_visible();
            $fields[] = $name;

            $address = new RBO_Field_Text('Address');
            $address->set_visible()->set_length(45);
            $fields[] = $address;

            $contactNum = new RBO_Field_Text('Contact Number');
            $contactNum->set_length(15)->set_visible();
            $fields[] = $contactNum;

            $birth_date = new RBO_Field_Date('Birth Date');
            $birth_date->set_required()->set_visible();
            $fields[] = $birth_date;

            $age = new RBO_Field_Integer('Age');
            $age->set_required()->set_visible();
            $fields[] = $age;

            return $fields;
        }

        public function table_name() {
            return 'eyeworx_patient';
        }
    }

?>